package com.wang.controller;


import com.wang.param.ShopQueryParam;
import com.wang.reponse.ShopVo;
import com.wang.result.BaseResponse;
import com.wang.result.ResultUtils;
import com.wang.user.model.Shop;
import com.wang.user.model.ShopCollection;
import com.wang.user.service.ShopCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/shopcollection")
@Api(tags = "商铺收藏管理")
public class ShopCollectionController {
    @Resource
    private ShopCollectionService shopCollectionService;

    @GetMapping("/list")
    @ApiOperation(value = "查看当前用户的收藏的商铺列表")
    public BaseResponse<List<ShopVo>> listShopCollection(ShopQueryParam queryParam) {
        return ResultUtils.success(shopCollectionService.listShopCollection(queryParam));
    }

    @PostMapping("/submit")
    @ApiOperation(value = "收藏商铺")
    public BaseResponse<Boolean> collection(@RequestBody ShopCollection shopCollection) {
        return ResultUtils.success(shopCollectionService.collection(shopCollection));
    }

    @PostMapping("/cancel")
    @ApiOperation(value = "取消收藏")
    public BaseResponse<Boolean> cancel(@RequestBody ShopCollection shopCollection) {
        return ResultUtils.success(shopCollectionService.cancel(shopCollection));
    }
}
